{include file="public/header" /}
<link rel="stylesheet" href="/static/index/css/page/share.css">
<body>
<div class="build-navbar" data-title="邀请好友" data-transparent data-color="#fff" data-lcolor="#fff"></div>
<div class="main">
    <img src="/static/index/images/share/bg_yqhybigbj@2x.png" alt="" class="img-top"/>
    <div class="adv flex items-center justify-center">
        <img src="/static/index/images/share/ic_yqhytit@2x.png" alt="">
    </div>
    <div class="ma flex items-center justify-center">
        <img src="/static/index/images/share/bg_mabijing@2x.png" alt="" class="bg">
        <div class="flat">
            <div class="top flex flex-col items-center justify-center">
                <span class="title">邀请码</span>
                <span class="val">{$user.code}</span>
            </div>
            <div class="flex items-center justify-center">
                <div id="qrcode"></div>
            </div>

            <div class="share-btn copy" lay-click="copy">复制链接</div>
        </div>
    </div>
</div>
</body>
{include file="public/footer"/}
<script src="/static/index/js/clipboard.min.js"></script>
<script>
    layui.extend({qrcode: "{/}/static/index/js/core/qrcode"}).use(['qrcode', 'methods'], function (d) {
        var a = layui.jquery, ly = layui.layer;
        layui.qrcode.render('qrcode', {
            text: '{$url}',
        })

        a('.copy').click(function () {
            var clipboard = new ClipboardJS('.copy', {
                text: function () {
                    return '{$url}';
                }
            });
            clipboard.on("success", function (e) {
                e.clearSelection();
                ly.msg('复制成功')
            });
            clipboard.on("error", function (e) {
                ly.msg('复制失败')
            });
        })


    });
</script>
</html>